﻿using System;

using SharedGenomics.Workbench.Core;
using SharedGenomics.Annotations;

namespace SharedGenomics.Workbench.Presenters
{
    public abstract class AnnotationPresenter<TAnnotation> : Presenter, IAnnotationPresenter where TAnnotation : IAnnotation
    {
        private TAnnotation _annotation;

        public AnnotationPresenter(IView view)
            : base(view)
        {
        }

        public TAnnotation Annotation
        {
            get { return this._annotation; }
            set
            {
                this.OnAnnotationSet(value);
                this._annotation = value;
            }
        }

        protected abstract void OnAnnotationSet(TAnnotation annotation);

        #region IAnnotationPresenter Members

        IAnnotation IAnnotationPresenter.Annotation
        {
            get { return this._annotation; }
        }

        #endregion

        public override bool SnapshotOnOpen
        {
            get { return true; }
        }
    }
}
